package com.spider.silence.job;

import com.spider.silence.downloader.YiBinZeroJuLiDownLoader;
import com.spider.silence.pool.YiBinZeroJuLiLoaderPool;
import com.spider.silence.utils.CenterExecutorUtil;
import com.spider.silence.utils.PropertiesUtil;
import com.spider.silence.worker.Njd1ModuleWorker;
import com.spider.silence.worker.Njd1Worker;
import com.spider.silence.worker.YiBinZeroJuLiWoker;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.StatefulJob;

import java.util.List;

/**
 * Created by qiuhao on 2017/3/28.
 */
public class YiBinZeroJuLiJob implements StatefulJob {

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        YiBinZeroJuLiDownLoader downLoader=null;
        try{
            downLoader= YiBinZeroJuLiLoaderPool.getInstance().fetchDownLoader(1000);
            List<String> urlList=downLoader.getModulesUrlList();
            downLoader.generateTask(urlList);
        }catch (InterruptedException e){
            e.printStackTrace();
        }finally {
            YiBinZeroJuLiLoaderPool.getInstance().releaseDownLoader(downLoader);
        }
    }
}
